package com.snopy.leetcode.index1_1000.index1_100;

/**
 * @author snopy
 * @version 1.0.0
 * @classname Question69
 * @description x的平方根
 * @email 77912204@qq.com
 * @date 2022/04/03 3:23
 */
public class Question69 {
    public static void main(String[] args) {
        int num = mySqrt(7);
        System.out.println(num);
        //animation
    }
    /**
     * @Description x的平方根
     * @param x:
     * @return: int
     * @Date 2022-04-03
     * @Author txl77912204@gmail.com
     **/
    public static int mySqrt(int x) {
        if (x==0){
            return 0;
        }
        int ans = (int) Math.exp(0.5*Math.log(x));

        return (long)(ans+1)*(ans+1)<x?ans+1:ans;
    }
    /**
     * @Description 二分法求平方根
     * @param x:
     * @return: int
     * @Date 2022-04-10
     * @Author txl77912204@gmail.com
     **/
    public static int mySqrt2(int x) {
        return 0;

    }
}
